package org.example.circle;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

@Component
public class BeanA {

    /* 方式一：属性注入、 */
    @Autowired
    //@Lazy
    private BeanB beanB;

    /* 方式二：set方法注入 */
    //@Autowired
    public void setBeanB(BeanB beanB) {
        this.beanB = beanB;
    }

    /* 方式三：构造方法注入，无法解决循环依赖 */
    // @Autowired
    // public BeanA(BeanB beanB) {
    //     this.beanB = beanB;
    // }
}
